<!DOCTYPE html>
<html>
<head>
    <title>安置项目登记</title>
<#include "../common/common.ftl"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row  layui-col-space10">
        <div class="layui-col-xs12">
            <div class="layui-card">
                <div class="layui-card-header">安置项目登记</div>
                <div class="layui-card-body">
                    <form class="layui-form">
                        <input type="hidden" name="azProjectId" value="${(azProject.id)!}"/>
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属县市：</label>
                            <div class="layui-input-block">
                                <select id="townSelect" name="town" class="layui-input"></select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">项目编号：</label>
                            <div class="layui-input-block">
                                <input type="text" name="projectCode" id="projectCode" lay-verify="projectCode|required"
                                       value="${(azProject.projectCode)!}" autocomplete="off" placeholder="必填项"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">项目排序号：</label>
                            <div class="layui-input-block">
                                <input type="text" name="num" id="projectCode" lay-verify="required"
                                       value="${(azProject.num)!}" autocomplete="off" placeholder="必填项"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">项目名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="projectName" id="projectName" lay-verify="required"
                                       value="${(azProject.projectName)!}" autocomplete="off" placeholder="必填项"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">安置区建设规模(亩)：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" autocomplete="off"
                                       name="scaleArea" value="${(azProject.scaleArea)!}" lay-verify="bigDecimal"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">房源总面积(㎡)：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" autocomplete="off"
                                       name="allHouseArea" value="${(azProject.allHouseArea)!}"
                                       lay-verify="bigDecimal"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">房源总套数：</label>
                            <div class="layui-input-block">
                                <input type="text" name="houseCount"
                                       value="${(azProject.houseCount)!}" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">已办证房源套数：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bzHouseCount"
                                       value="${(azProject.bzHouseCount)!}" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">已办证车位套数：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bzCarLotCount"
                                       value="${(azProject.bzCarLotCount)!}" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">已办证储物间套数：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bzStorageRoomCount"
                                       value="${(azProject.bzStorageRoomCount)!}" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">备注：</label>
                            <div class="layui-input-block">
                                <textarea class="layui-textarea" name="memo">${(azProject.memo)!}</textarea>
                            </div>
                        </div>
                        <button style="display: none;" class="layui-btn" id="submitBtn" name="submitBtn" lay-submit=""
                                lay-filter="submit">立即提交
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['form', 'laydate', "verify", "dataDict"], function () {
        var form = layui.form, laydate = layui.laydate, $ = layui.jquery, verify = layui.verify, dataDict = layui.dataDict,
                parentIndex = parent.layer.getFrameIndex(window.name);

        dataDict.select("乡镇", "townSelect", "${(azProject.town)!"01"}");
        //父页面通过submit按钮click方法，触发以下验证功能
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: "azProjectSave"
                , type: "post"
                , data: data.field
                , success: function (data) {
                    if (data.code == "0001") {
                        layer.alert("配置成功！");
                        parent.loadData();
                        parent.layer.close(parentIndex);
                    } else {
                        layer.msg(data.message, {anim: 6, icon: 2});
                    }
                }
            });
            return false;
        });
        form.verify({
            projectCode: function (value) {//项目编号非重验证
                var msg = "";
                $.ajax({
                    url: 'validateAzProjectCode',
                    type: 'post',
                    data: {azProjectCode: value, azProjectId: '${(azProject.id)!}'},
                    async: false,
                    success: function (data) {
                        msg = data;
                    }
                });
                return msg;
            }
        });
    });
</script>
</body>
</html>